

// 数据的 存 取 删



 // 存
 export  const setItem = (key, value ) => {   
  
    if(typeof value == 'object' ){
        window.localStorage.setItem(key, JSON.stringify(value))
    }else{
        window.localStorage.setItem(key, value)
    }


 }
 

 // 取
 export  const getItem = (key) => {   
    let data =  window.localStorage.getItem(key) 
    
    try {
       return  JSON.parse(data) 
    } catch (error) {
        return  data            
    }
 }


 // 删
export  const removeItem = (key) => {   
  
   window.localStorage.removeItem(key)
}